# demo03_json.py
import json
# Python类型数据 -> json   json.dumps(Python类型数据)
dict01 = {"name": "nfx", "age": 18}
json_obj = json.dumps(dict01)
print(json_obj, type(json_obj))

# json -> Python类型数据   json.loads(json类型数据)
py_obj = json.loads(json_obj)
print(type(py_obj))
for key in py_obj.keys():
    print("key:", key, "value:", py_obj[key])
